const conf = new (require('conf'))()
const chalk = require('chalk')
const LoginAPI = require('./../api/login')


async function login (token) {
    const loginAPI = new LoginAPI();
    const accessToken = await loginAPI.login(token)

    if (accessToken) {
        conf.set("accessToken", accessToken);
        console.info(chalk.greenBright("login successful !!"))
    } else {
        console.info(chalk.redBright("login error !!"))
    }
}
module.exports = login;
